package v1

import (
	"gf_blog_admin/internal/model"
	"github.com/gogf/gf/v2/frame/g"
)

type RoleListReq struct {
	g.Meta `path:"/system/role" method:"get" tags:"system" sm:"角色列表" can:"system.role"`
	model.RoleListInput
}

type RoleListRes struct {
	Total int               `json:"total" dc:"数据总数"`
	Rows  []*model.RoleItem `json:"rows" dc:"列表集合"`
}

type RoleAllReq struct {
	g.Meta `path:"/system/role/all" method:"get" tags:"system" sm:"角色列表" noCan:"true"`
}

type RoleAllRes struct {
	Rows []*model.RoleAllItem `json:"rows"`
}

type RoleStoreReq struct {
	g.Meta `path:"/system/role/store" method:"post" tags:"system" sm:"角色创建" can:"system.role.store"`
	model.RoleFormInput
}

type RoleStoreRes struct{}

type RoleUpdateReq struct {
	g.Meta `path:"/system/role/update/{id}" method:"put" tags:"system" sm:"角色更新" can:"system.role.update"`
	Id     uint64 `json:"id" in:"query" v:"required|min:1" dc:"角色id"`
	model.RoleFormInput
}

type RoleUpdateRes struct{}

type RoleDestroyReq struct {
	g.Meta `path:"/system/role/destroy" method:"delete" tags:"system" sm:"角色删除" can:"system.role.destroy"`
	Ids    []uint64 `json:"ids" v:"required|array|max-length:200" dc:"角色id集合"`
}

type RoleDestroyRes struct{}

type RolePermissionsReq struct {
	g.Meta `path:"/system/role/permission/{id}" method:"get" tags:"system" sm:"角色权限" can:"system.role.permission"`
	Id     uint64 `json:"id" in:"query" v:"required|min:1" dc:"角色id"`
}

type RolePermissionsRes struct {
	*model.RolePermissionsOutput
}

type RoleAssignPermissionsReq struct {
	g.Meta      `path:"/system/role/permission/{id}" method:"put" tags:"system" sm:"角色权限更新" can:"system.role.permission"`
	Id          uint64   `json:"id" in:"query" v:"required|min:1" dc:"角色id"`
	Permissions []string `json:"permissions" v:"required|array" dc:"权限集合"`
}

type RoleAssignPermissionsRes struct{}
